home *** CD-ROM | disk | FTP | other *** search
/ PC/CD Gamer UK 123 / CD Gamer Issue 123 (June 2003) (Disc 1).ISO / Games / Dev_Demo_EU / data1.cab / App_Executables / OpenAL / Inc / al.h next >
Encoding:
C/C++ Source or Header  |  2003-02-28  |  14.9 KB  |  491 lines

  1. #ifndef _AL_H_
  2. #define _AL_H_
  3.  
  4. /**
  5.  * OpenAL cross platform audio library
  6.  * Copyright (C) 1999-2000 by authors.
  7.  * This library is free software; you can redistribute it and/or
  8.  *  modify it under the terms of the GNU Library General Public
  9.  *  License as published by the Free Software Foundation; either
  10.  *  version 2 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  *  Library General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Library General Public
  18.  *  License along with this library; if not, write to the
  19.  *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  *  Boston, MA  02111-1307, USA.
  21.  * Or go to http://www.gnu.org/copyleft/lgpl.html
  22.  */
  23. #include "altypes.h"
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. #ifdef _WIN32
  30.  #ifdef _OPENAL32LIB
  31.   #define ALAPI __declspec(dllexport)
  32.  #else
  33.   #define ALAPI __declspec(dllimport)
  34.  #endif
  35.  #define ALAPIENTRY __cdecl
  36.  #define AL_CALLBACK
  37. #else
  38.  #ifdef TARGET_OS_MAC
  39.   #if TARGET_OS_MAC
  40.    #pragma export on
  41.   #endif
  42.  #endif
  43.  #define ALAPI
  44.  #define ALAPIENTRY __cdecl
  45.  #define AL_CALLBACK
  46. #endif
  47.  
  48. #define OPENAL
  49.  
  50. #ifndef AL_NO_PROTOTYPES
  51.  
  52. /**
  53.  * OpenAL Maintenance Functions
  54.  * Initialization and exiting.
  55.  * State Management and Query.
  56.  * Error Handling.
  57.  * Extension Support.
  58.  */
  59.  
  60. /** State management. */
  61. ALAPI ALvoid    ALAPIENTRY alEnable( ALenum capability );
  62. ALAPI ALvoid    ALAPIENTRY alDisable( ALenum capability ); 
  63. ALAPI ALboolean ALAPIENTRY alIsEnabled( ALenum capability ); 
  64.  
  65. /** Application preferences for driver performance choices. */
  66. ALAPI ALvoid    ALAPIENTRY alHint( ALenum target, ALenum mode );
  67.  
  68. /** State retrieval. */
  69. ALAPI ALboolean ALAPIENTRY alGetBoolean( ALenum param );
  70. ALAPI ALint        ALAPIENTRY alGetInteger( ALenum param );
  71. ALAPI ALfloat    ALAPIENTRY alGetFloat( ALenum param );
  72. ALAPI ALdouble    ALAPIENTRY alGetDouble( ALenum param );
  73. ALAPI ALvoid    ALAPIENTRY alGetBooleanv( ALenum param, ALboolean* data );
  74. ALAPI ALvoid    ALAPIENTRY alGetIntegerv( ALenum param, ALint* data );
  75. ALAPI ALvoid    ALAPIENTRY alGetFloatv( ALenum param, ALfloat* data );
  76. ALAPI ALvoid    ALAPIENTRY alGetDoublev( ALenum param, ALdouble* data );
  77. ALAPI ALubyte*    ALAPIENTRY alGetString( ALenum param );
  78.  
  79. /**
  80.  * Error support.
  81.  * Obtain the most recent error generated in the AL state machine.
  82.  */
  83. ALAPI ALenum    ALAPIENTRY alGetError( ALvoid );
  84.  
  85.  
  86. /** 
  87.  * Extension support.
  88.  * Obtain the address of a function (usually an extension)
  89.  *  with the name fname. All addresses are context-independent. 
  90.  */
  91. ALAPI ALboolean ALAPIENTRY alIsExtensionPresent( ALubyte* fname );
  92.  
  93.  
  94. /** 
  95.  * Extension support.
  96.  * Obtain the address of a function (usually an extension)
  97.  *  with the name fname. All addresses are context-independent. 
  98.  */
  99. ALAPI ALvoid*    ALAPIENTRY alGetProcAddress( ALubyte* fname );
  100.  
  101.  
  102. /**
  103.  * Extension support.
  104.  * Obtain the integer value of an enumeration (usually an extension) with the name ename. 
  105.  */
  106. ALAPI ALenum    ALAPIENTRY alGetEnumValue( ALubyte* ename );
  107.  
  108.  
  109.  
  110.  
  111. /**
  112.  * LISTENER
  113.  * Listener is the sample position for a given context.
  114.  * The multi-channel (usually stereo) output stream generated
  115.  *  by the mixer is parametrized by this Listener object:
  116.  *  its position and velocity relative to Sources, within
  117.  *  occluder and reflector geometry.
  118.  */
  119.  
  120.  
  121.  
  122. /**
  123.  *
  124.  * Listener Environment:  default 0.
  125.  */
  126. ALAPI ALvoid    ALAPIENTRY alListeneri( ALenum param, ALint value );
  127.  
  128.  
  129. /**
  130.  *
  131.  * Listener Gain:  default 1.0f.
  132.  */
  133. ALAPI ALvoid    ALAPIENTRY alListenerf( ALenum param, ALfloat value );
  134.  
  135.  
  136. /**  
  137.  *
  138.  * Listener Position.
  139.  * Listener Velocity.
  140.  */
  141. ALAPI ALvoid    ALAPIENTRY alListener3f( ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 ); 
  142.  
  143.  
  144. /**
  145.  *
  146.  * Listener Position:        ALfloat[3]
  147.  * Listener Velocity:        ALfloat[3]
  148.  * Listener Orientation:     ALfloat[6]  (forward and up vector).
  149.  */
  150. ALAPI ALvoid    ALAPIENTRY alListenerfv( ALenum param, ALfloat* values ); 
  151.  
  152. ALAPI ALvoid    ALAPIENTRY alGetListeneri( ALenum param, ALint* value );
  153. ALAPI ALvoid    ALAPIENTRY alGetListenerf( ALenum param, ALfloat* value );
  154. ALAPI ALvoid    ALAPIENTRY alGetListener3f( ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 ); 
  155. ALAPI ALvoid    ALAPIENTRY alGetListenerfv( ALenum param, ALfloat* values ); 
  156.  
  157.  
  158. /**
  159.  * SOURCE
  160.  * Source objects are by default localized. Sources
  161.  *  take the PCM data provided in the specified Buffer,
  162.  *  apply Source-specific modifications, and then
  163.  *  submit them to be mixed according to spatial 
  164.  *  arrangement etc.
  165.  */
  166.  
  167.  
  168.  
  169. /** Create Source objects. */
  170. ALAPI ALvoid    ALAPIENTRY alGenSources( ALsizei n, ALuint* sources ); 
  171.  
  172. /** Delete Source objects. */
  173. ALAPI ALvoid    ALAPIENTRY alDeleteSources( ALsizei n, ALuint* sources );
  174.  
  175. /** Verify a handle is a valid Source. */ 
  176. ALAPI ALboolean ALAPIENTRY alIsSource( ALuint id ); 
  177.  
  178. /** Set an integer parameter for a Source object. */
  179. ALAPI ALvoid    ALAPIENTRY alSourcei( ALuint source, ALenum param, ALint value ); 
  180. ALAPI ALvoid    ALAPIENTRY alSourcef( ALuint source, ALenum param, ALfloat value ); 
  181. ALAPI ALvoid    ALAPIENTRY alSource3f( ALuint source, ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  182. ALAPI ALvoid    ALAPIENTRY alSourcefv( ALuint source, ALenum param, ALfloat* values ); 
  183.  
  184. /** Get an integer parameter for a Source object. */
  185. ALAPI ALvoid    ALAPIENTRY alGetSourcei( ALuint source,  ALenum param, ALint* value );
  186. ALAPI ALvoid    ALAPIENTRY alGetSourcef( ALuint source,  ALenum param, ALfloat* value );
  187. ALAPI ALvoid    ALAPIENTRY alGetSource3f( ALuint source,  ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 );
  188. ALAPI ALvoid    ALAPIENTRY alGetSourcefv( ALuint source, ALenum param, ALfloat* values );
  189.  
  190. ALAPI ALvoid    ALAPIENTRY alSourcePlayv( ALsizei n, ALuint *sources );
  191. ALAPI ALvoid    ALAPIENTRY alSourcePausev( ALsizei n, ALuint *sources );
  192. ALAPI ALvoid    ALAPIENTRY alSourceStopv( ALsizei n, ALuint *sources );
  193. ALAPI ALvoid    ALAPIENTRY alSourceRewindv(ALsizei n,ALuint *sources);
  194.  
  195. /** Activate a source, start replay. */
  196. ALAPI ALvoid    ALAPIENTRY alSourcePlay( ALuint source );
  197.  
  198. /**
  199.  * Pause a source, 
  200.  *  temporarily remove it from the mixer list.
  201.  */
  202. ALAPI ALvoid    ALAPIENTRY alSourcePause( ALuint source );
  203.  
  204. /**
  205.  * Stop a source,
  206.  *  temporarily remove it from the mixer list,
  207.  *  and reset its internal state to pre-Play.
  208.  * To remove a Source completely, it has to be
  209.  *  deleted following Stop, or before Play.
  210.  */
  211. ALAPI ALvoid    ALAPIENTRY alSourceStop( ALuint source );
  212.  
  213. /**
  214.  * Rewinds a source, 
  215.  *  temporarily remove it from the mixer list,
  216.  *  and reset its internal state to pre-Play.
  217.  */
  218. ALAPI ALvoid    ALAPIENTRY alSourceRewind( ALuint source );
  219.  
  220.  
  221.  
  222. /**
  223.  * BUFFER
  224.  * Buffer objects are storage space for sample data.
  225.  * Buffers are referred to by Sources. There can be more than
  226.  *  one Source using the same Buffer data. If Buffers have
  227.  *  to be duplicated on a per-Source basis, the driver has to
  228.  *  take care of allocation, copying, and deallocation as well
  229.  *  as propagating buffer data changes.
  230.  */
  231.  
  232.  
  233.  
  234.  
  235. /** Buffer object generation. */
  236. ALAPI ALvoid     ALAPIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
  237. ALAPI ALvoid    ALAPIENTRY alDeleteBuffers( ALsizei n, ALuint* buffers );
  238. ALAPI ALboolean ALAPIENTRY alIsBuffer( ALuint buffer );
  239.  
  240. /**
  241.  * Specify the data to be filled into a buffer.
  242.  */
  243. ALAPI ALvoid    ALAPIENTRY alBufferData( ALuint   buffer,
  244.                                          ALenum   format,
  245.                                          ALvoid*  data,
  246.                                          ALsizei  size,
  247.                                          ALsizei  freq );
  248.  
  249.  
  250. ALAPI ALvoid    ALAPIENTRY alGetBufferi( ALuint buffer, ALenum param, ALint*   value );
  251. ALAPI ALvoid    ALAPIENTRY alGetBufferf( ALuint buffer, ALenum param, ALfloat* value );
  252.  
  253.  
  254.  
  255.  
  256. /**
  257.  * Queue stuff
  258.  */
  259.  
  260. ALAPI ALvoid    ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, ALuint* buffers );
  261. ALAPI ALvoid    ALAPIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALuint* buffers );
  262.  
  263. /**
  264.  * Knobs and dials
  265.  */
  266. ALAPI ALvoid    ALAPIENTRY alDistanceModel( ALenum value );
  267. ALAPI ALvoid    ALAPIENTRY alDopplerFactor( ALfloat value );
  268. ALAPI ALvoid    ALAPIENTRY alDopplerVelocity( ALfloat value );
  269.  
  270. #else /* AL_NO_PROTOTYPES */
  271.  
  272. /**
  273.  * OpenAL Maintenance Functions
  274.  * Initialization and exiting.
  275.  * State Management and Query.
  276.  * Error Handling.
  277.  * Extension Support.
  278.  */
  279.  
  280. /** State management. */
  281. ALAPI ALvoid    ALAPIENTRY (*alEnable)( ALenum capability );
  282. ALAPI ALvoid    ALAPIENTRY (*alDisable)( ALenum capability ); 
  283. ALAPI ALboolean ALAPIENTRY (*alIsEnabled)( ALenum capability ); 
  284.  
  285. /** Application preferences for driver performance choices. */
  286. ALAPI ALvoid    ALAPIENTRY (*alHint)( ALenum target, ALenum mode );
  287.  
  288. /** State retrieval. */
  289. ALAPI ALboolean ALAPIENTRY (*alGetBoolean)( ALenum param );
  290. ALAPI ALint        ALAPIENTRY (*alGetInteger)( ALenum param );
  291. ALAPI ALfloat    ALAPIENTRY (*alGetFloat)( ALenum param );
  292. ALAPI ALdouble    ALAPIENTRY (*alGetDouble)( ALenum param );
  293. ALAPI ALvoid    ALAPIENTRY (*alGetBooleanv)( ALenum param, ALboolean* data );
  294. ALAPI ALvoid    ALAPIENTRY (*alGetIntegerv)( ALenum param, ALint* data );
  295. ALAPI ALvoid    ALAPIENTRY (*alGetFloatv)( ALenum param, ALfloat* data );
  296. ALAPI ALvoid    ALAPIENTRY (*alGetDoublev)( ALenum param, ALdouble* data );
  297. ALAPI ALubyte*    ALAPIENTRY (*alGetString)( ALenum param );
  298.  
  299. /**
  300.  * Error support.
  301.  * Obtain the most recent error generated in the AL state machine.
  302.  */
  303. ALAPI ALenum    ALAPIENTRY (*alGetError)( ALvoid );
  304.  
  305.  
  306. /** 
  307.  * Extension support.
  308.  * Obtain the address of a function (usually an extension)
  309.  *  with the name fname. All addresses are context-independent. 
  310.  */
  311. ALAPI ALboolean ALAPIENTRY (*alIsExtensionPresent)( ALubyte* fname );
  312.  
  313.  
  314. /** 
  315.  * Extension support.
  316.  * Obtain the address of a function (usually an extension)
  317.  *  with the name fname. All addresses are context-independent. 
  318.  */
  319. ALAPI ALvoid*    ALAPIENTRY (*alGetProcAddress)( ALubyte* fname );
  320.  
  321.  
  322. /**
  323.  * Extension support.
  324.  * Obtain the integer value of an enumeration (usually an extension) with the name ename. 
  325.  */
  326. ALAPI ALenum    ALAPIENTRY (*alGetEnumValue)( ALubyte* ename );
  327.  
  328.  
  329.  
  330.  
  331. /**
  332.  * LISTENER
  333.  * Listener is the sample position for a given context.
  334.  * The multi-channel (usually stereo) output stream generated
  335.  *  by the mixer is parametrized by this Listener object:
  336.  *  its position and velocity relative to Sources, within
  337.  *  occluder and reflector geometry.
  338.  */
  339.  
  340.  
  341.  
  342. /**
  343.  *
  344.  * Listener Environment:  default 0.
  345.  */
  346. ALAPI ALvoid    ALAPIENTRY (*alListeneri)( ALenum param, ALint value );
  347.  
  348.  
  349. /**
  350.  *
  351.  * Listener Gain:  default 1.0f.
  352.  */
  353. ALAPI ALvoid    ALAPIENTRY (*alListenerf)( ALenum param, ALfloat value );
  354.  
  355.  
  356. /**  
  357.  *
  358.  * Listener Position.
  359.  * Listener Velocity.
  360.  */
  361. ALAPI ALvoid    ALAPIENTRY (*alListener3f)( ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 ); 
  362.  
  363.  
  364. /**
  365.  *
  366.  * Listener Position:        ALfloat[3]
  367.  * Listener Velocity:        ALfloat[3]
  368.  * Listener Orientation:     ALfloat[6]  (forward and up vector).
  369.  */
  370. ALAPI ALvoid    ALAPIENTRY (*alListenerfv)( ALenum param, ALfloat* values ); 
  371.  
  372. ALAPI ALvoid    ALAPIENTRY (*alGetListeneri)( ALenum param, ALint* value );
  373. ALAPI ALvoid    ALAPIENTRY (*alGetListenerf)( ALenum param, ALfloat* value );
  374. ALAPI ALvoid    ALAPIENTRY (*alGetListener3f)( ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 ); 
  375. ALAPI ALvoid    ALAPIENTRY (*alGetListenerfv)( ALenum param, ALfloat* values ); 
  376.  
  377.  
  378. /**
  379.  * SOURCE
  380.  * Source objects are by default localized. Sources
  381.  *  take the PCM data provided in the specified Buffer,
  382.  *  apply Source-specific modifications, and then
  383.  *  submit them to be mixed according to spatial 
  384.  *  arrangement etc.
  385.  */
  386.  
  387.  
  388.  
  389. /** Create Source objects. */
  390. ALAPI ALvoid    ALAPIENTRY (*alGenSources)( ALsizei n, ALuint* sources ); 
  391.  
  392. /** Delete Source objects. */
  393. ALAPI ALvoid    ALAPIENTRY (*alDeleteSources)( ALsizei n, ALuint* sources );
  394.  
  395. /** Verify a handle is a valid Source. */ 
  396. ALAPI ALboolean ALAPIENTRY (*alIsSource)( ALuint id ); 
  397.  
  398. /** Set an integer parameter for a Source object. */
  399. ALAPI ALvoid    ALAPIENTRY (*alSourcei)( ALuint source, ALenum param, ALint value ); 
  400. ALAPI ALvoid    ALAPIENTRY (*alSourcef)( ALuint source, ALenum param, ALfloat value ); 
  401. ALAPI ALvoid    ALAPIENTRY (*alSource3f)( ALuint source, ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  402. ALAPI ALvoid    ALAPIENTRY (*alSourcefv)( ALuint source, ALenum param, ALfloat* values ); 
  403.  
  404. /** Get an integer parameter for a Source object. */
  405. ALAPI ALvoid    ALAPIENTRY (*alGetSourcei)( ALuint source,  ALenum param, ALint* value );
  406. ALAPI ALvoid    ALAPIENTRY (*alGetSourcef)( ALuint source,  ALenum param, ALfloat* value );
  407. ALAPI ALvoid    ALAPIENTRY (*alGetSourcefv)( ALuint source, ALenum param, ALfloat* values );
  408.  
  409. ALAPI ALvoid    ALAPIENTRY (*alSourcePlayv)( ALsizei n, ALuint *sources );
  410. ALAPI ALvoid    ALAPIENTRY (*alSourceStopv)( ALsizei n, ALuint *sources );
  411.  
  412. /** Activate a source, start replay. */
  413. ALAPI ALvoid    ALAPIENTRY (*alSourcePlay)( ALuint source );
  414.  
  415. /**
  416.  * Pause a source, 
  417.  *  temporarily remove it from the mixer list.
  418.  */
  419. ALAPI ALvoid    ALAPIENTRY (*alSourcePause)( ALuint source );
  420.  
  421. /**
  422.  * Stop a source,
  423.  *  temporarily remove it from the mixer list,
  424.  *  and reset its internal state to pre-Play.
  425.  * To remove a Source completely, it has to be
  426.  *  deleted following Stop, or before Play.
  427.  */
  428. ALAPI ALvoid    ALAPIENTRY (*alSourceStop)( ALuint source );
  429.  
  430.  
  431.  
  432. /**
  433.  * BUFFER
  434.  * Buffer objects are storage space for sample data.
  435.  * Buffers are referred to by Sources. There can be more than
  436.  *  one Source using the same Buffer data. If Buffers have
  437.  *  to be duplicated on a per-Source basis, the driver has to
  438.  *  take care of allocation, copying, and deallocation as well
  439.  *  as propagating buffer data changes.
  440.  */
  441.  
  442.  
  443.  
  444.  
  445. /** Buffer object generation. */
  446. ALAPI ALvoid     ALAPIENTRY (*alGenBuffers)( ALsizei n, ALuint* buffers );
  447. ALAPI ALvoid    ALAPIENTRY (*alDeleteBuffers)( ALsizei n, ALuint* buffers );
  448. ALAPI ALboolean ALAPIENTRY (*alIsBuffer)( ALuint buffer );
  449.  
  450. /**
  451.  * Specify the data to be filled into a buffer.
  452.  */
  453. ALAPI ALvoid    ALAPIENTRY (*alBufferData)( ALuint   buffer,
  454.                                             ALenum   format,
  455.                                             ALvoid*  data,
  456.                                             ALsizei  size,
  457.                                             ALsizei  freq );
  458.  
  459. ALAPI ALvoid    ALAPIENTRY (*alGetBufferi)( ALuint buffer, ALenum param, ALint*   value );
  460. ALAPI ALvoid    ALAPIENTRY (*alGetBufferf)( ALuint buffer, ALenum param, ALfloat* value );
  461.  
  462.  
  463.  
  464.  
  465. /**
  466.  * Queue stuff
  467.  */
  468. ALAPI ALvoid    ALAPIENTRY (*alSourceQueueBuffers)( ALuint source, ALsizei n, ALuint* buffers );
  469. ALAPI ALvoid    ALAPIENTRY (*alSourceUnqueueBuffers)( ALuint source, ALsizei n, ALuint* buffers );
  470.  
  471. /**
  472.  * Knobs and dials
  473.  */
  474. ALAPI ALvoid    ALAPIENTRY (*alDistanceModel)( ALenum value );
  475. ALAPI ALvoid    ALAPIENTRY (*alDopplerFactor)( ALfloat value );
  476. ALAPI ALvoid    ALAPIENTRY (*alDopplerVelocity)( ALfloat value );
  477.  
  478. #endif /* AL_NO_PROTOTYPES */
  479.  
  480. #ifdef TARGET_OS_MAC
  481.  #if TARGET_OS_MAC
  482.   #pragma export off
  483.  #endif
  484. #endif
  485.  
  486. #ifdef __cplusplus
  487. }
  488. #endif
  489.  
  490. #endif
  491.